<?php

  $User = getRowByFields($_SQL_TABLE['user'], array("id = ".$dbSet->quoteValue($pct->getParam('task')), "active = 'y'"));
  if(!$User['id'])
  {    pageNotFound();
  }

    $query = "
      			SELECT c.id, c.user AS userId, c.date, c.body".__FLANG." AS body, c1.body".__FLANG." AS root, u.login AS user, c1.id AS rootId, c1.date AS rootDate, c1.user AS rootUserId, u1.login AS rootUser
      			FROM ".$_SQL_TABLE['comment']." c
      			INNER JOIN ".$_SQL_TABLE['user']." u ON u.id = c.user
      			LEFT JOIN ".$_SQL_TABLE['comment']." c1 ON c1.id = c.root AND c1.active = 'y'
      			LEFT JOIN ".$_SQL_TABLE['user']." u1 ON u1.id = c1.user
      			WHERE
      					c.active = 'y'
      				AND	u.active = 'y'
      				AND c.user = ".$User['id']."
                ORDER BY c.date
      ";
      $dbSet->open($query);
      $Comments = $dbSet->fetchRowsAll();

  $tpl->assign("Comments", $Comments);
  $tpl->assign("PageTitle", $User['login']);

  $_BODY_SMARTY_TEMPLATE = $CONFIG['ModulesFolder']."module.users.tpl";

?>